package com.sunwayworld.basemodule.samplemanage.location.dao.impl;

import com.sunwayworld.framework.mybatis.mapper.MapperParameter;
import com.sunwayworld.framework.support.PersistableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.sunwayworld.basemodule.samplemanage.location.bean.LimsLocationBean;
import com.sunwayworld.basemodule.samplemanage.location.dao.LimsLocationDao;
import com.sunwayworld.basemodule.samplemanage.location.mapper.LimsLocationMapper;
import com.sunwayworld.framework.mybatis.dao.MybatisDaoSupport;
import com.sunwayworld.framework.spring.annotation.GikamBean;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Repository
@GikamBean
public class LimsLocationDaoImpl extends MybatisDaoSupport<LimsLocationBean, Long> implements LimsLocationDao {

    @Autowired
    private LimsLocationMapper limsLocationMapper;

    @Override
    public LimsLocationMapper getMapper() {
        return limsLocationMapper;
    }

    @Override
    public List<LimsLocationBean> selectTreeNodeList(MapperParameter parameter) {
        return getMapper().selectTreeNodeList(parameter).stream()
                .map(e -> PersistableHelper.mapToPersistable(e, LimsLocationBean.class))
                .collect(Collectors.toList());
    }

    @Override
    public String selectMaxSorterByLevel(String level) {
        return getMapper().selectMaxSorterByLevel(level);
    }

    @Override
    public void deleteByGroup(String group) {
        getMapper().deleteByGroup(group);
    }

    @Override
    public int selectTreeNodeCount(MapperParameter parameter) {
        return getMapper().selectTreeNodeCount(parameter);
    }

    @Override
    public String selectMaxSorterByParam(MapperParameter temp) {
        return getMapper().selectMaxSorterByParam(temp);
    }

    @Override
    public List<Map<String, Object>> staticData(String codeCategoryId) {
        return getMapper().staticData(codeCategoryId);
    }

    @Override
    public String selectNextLayer(String level) {
        return getMapper().selectNextLayer(level);
    }

    @Override
    public String selectNextLayer(String level, String groupId) {
        return getMapper().selectNextLayer2(level, groupId);
    }

    @Override
    public List<Map<String, Object>> selectBoardList() {
        return getMapper().selectBoardList();
    }

    @Override
    public void updateColorFlag(String locationNo,String color) {
        getMapper().updateColorFlag(locationNo, color);
    }

    @Override
    public List<Map<String, Object>> kshStorageSelectable() {
        return getMapper().kshStorageSelectable();
    }
}
